package org.grow.jpa2.controller;

import org.grow.jpa2.dao.GoodsJpa;
import org.grow.jpa2.entity.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: xwg
 * @CreateDate: 21-5-27
 */
@CrossOrigin
@RestController
public class GoodsController {


    @Autowired
    private GoodsJpa goodsJpa;
    @PostMapping("/goods")
    public Goods insertGoods(@RequestBody Goods goods){
//        goods.setGoodsId(0);
        Goods saved = goodsJpa.save(goods);
        return saved;
    }



}
